import { S } from '../../s';
import { IPSApplication } from '../../app/ipsapplication';
import { IPSAppFunc } from '../../app/func/ipsapp-func';
import { IPSControlAttribute } from '../ipscontrol-attribute';
import { IPSControlLogic } from '../ipscontrol-logic';
import { IPSControlRender } from '../ipscontrol-render';
import { IPSNavigateContext } from '../ipsnavigate-context';
import { IPSNavigateParam } from '../ipsnavigate-param';
import { IPSLayout } from '../layout/ipslayout';
import { IPSLayoutPos } from '../layout/ipslayout-pos';
import { IPSAppMenuItem } from './ipsapp-menu-item';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysCss } from '../../res/ipssys-css';
import { IPSSysImage } from '../../res/ipssys-image';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppMenuItemImplBase
  extends PSModelObjectImpl
  implements IPSAppMenuItem
{
  get accUserMode(): 0 | 2 | 3 | 4 {
    return this.M.accUserMode;
  }

  get accessKey(): string {
    return this.M.accessKey;
  }

  get appMenuItemState(): 1 | 2 {
    return this.M.appMenuItemState != null ? this.M.appMenuItemState : 0;
  }

  protected cappslanguageres: IPSLanguageRes;
  getCapPSLanguageRes(): IPSLanguageRes | null {
    return (
      this.cappslanguageres ||
      (this.cappslanguageres = this.fillObjectModel(
        S._276,
        this.M.getCapPSLanguageRes,
        S._2a8,
      ) as IPSLanguageRes)
    );
  }

  get caption(): string {
    return this.M.caption;
  }

  get counterId(): string {
    return this.M.counterId;
  }

  get cssStyle(): string {
    return this.M.cssStyle;
  }

  get data(): string {
    return this.M.data;
  }

  get dynaClass(): string {
    return this.M.dynaClass;
  }

  get informTag(): string {
    return this.M.informTag;
  }

  get informTag2(): string {
    return this.M.informTag2;
  }

  get itemType():
    | 'SEPERATOR'
    | 'USERITEM'
    | 'APPMENUREF'
    | 'MENUITEM'
    | 'RAWITEM' {
    return this.M.itemType;
  }

  protected psappfunc: IPSAppFunc;
  getPSAppFunc(): IPSAppFunc | null {
    if (this.psappfunc != null) return this.psappfunc;
    const value = this.M.getPSAppFunc;
    if (value == null) {
      return;
    }
    const ipsapplication = this.getParentPSModelObject(
      S._26e,
    ) as IPSApplication;
    if (ipsapplication != null) {
      this.psappfunc = ipsapplication.findPSAppFunc(value);
    }
    return this.psappfunc;
  }

  protected psappmenuitems: IPSAppMenuItem[];
  getPSAppMenuItems(): IPSAppMenuItem[] | null {
    return (
      this.psappmenuitems ||
      (this.psappmenuitems = this.fillChildListModel(
        this.M.getPSAppMenuItems,
        S._da,
      ) as IPSAppMenuItem[])
    );
  }

  findPSAppMenuItem(objKey: any): IPSAppMenuItem | null {
    return this.getPSModel5(
      S._da,
      this.getPSAppMenuItems(),
      objKey,
    ) as IPSAppMenuItem;
  }

  protected pscontrolattributes: IPSControlAttribute[];
  getPSControlAttributes(): IPSControlAttribute[] | null {
    return (
      this.pscontrolattributes ||
      (this.pscontrolattributes = this.fillChildListModel(
        this.M.getPSControlAttributes,
        S._3f5,
      ) as IPSControlAttribute[])
    );
  }

  findPSControlAttribute(objKey: any): IPSControlAttribute | null {
    return this.getPSModel5(
      S._3f5,
      this.getPSControlAttributes(),
      objKey,
    ) as IPSControlAttribute;
  }

  protected pscontrollogics: IPSControlLogic[];
  getPSControlLogics(): IPSControlLogic[] | null {
    return (
      this.pscontrollogics ||
      (this.pscontrollogics = this.fillChildListModel(
        this.M.getPSControlLogics,
        S._38d,
      ) as IPSControlLogic[])
    );
  }

  findPSControlLogic(objKey: any): IPSControlLogic | null {
    return this.getPSModel5(
      S._38d,
      this.getPSControlLogics(),
      objKey,
    ) as IPSControlLogic;
  }

  protected pscontrolrenders: IPSControlRender[];
  getPSControlRenders(): IPSControlRender[] | null {
    return (
      this.pscontrolrenders ||
      (this.pscontrolrenders = this.fillChildListModel(
        this.M.getPSControlRenders,
        S._3f6,
      ) as IPSControlRender[])
    );
  }

  findPSControlRender(objKey: any): IPSControlRender | null {
    return this.getPSModel5(
      S._3f6,
      this.getPSControlRenders(),
      objKey,
    ) as IPSControlRender;
  }

  protected pslayout: IPSLayout;
  getPSLayout(): IPSLayout | null {
    return (
      this.pslayout ||
      (this.pslayout = this.fillObjectModel(
        S._298,
        this.M.getPSLayout,
        S._2e8,
      ) as IPSLayout)
    );
  }

  protected pslayoutpos: IPSLayoutPos;
  getPSLayoutPos(): IPSLayoutPos | null {
    return (
      this.pslayoutpos ||
      (this.pslayoutpos = this.fillObjectModel(
        S._299,
        this.M.getPSLayoutPos,
        S._2e9,
      ) as IPSLayoutPos)
    );
  }

  protected psnavigatecontexts: IPSNavigateContext[];
  getPSNavigateContexts(): IPSNavigateContext[] | null {
    return (
      this.psnavigatecontexts ||
      (this.psnavigatecontexts = this.fillChildListModel(
        this.M.getPSNavigateContexts,
        S._8c,
      ) as IPSNavigateContext[])
    );
  }

  findPSNavigateContext(objKey: any): IPSNavigateContext | null {
    return this.getPSModel5(
      S._8c,
      this.getPSNavigateContexts(),
      objKey,
    ) as IPSNavigateContext;
  }

  protected psnavigateparams: IPSNavigateParam[];
  getPSNavigateParams(): IPSNavigateParam[] | null {
    return (
      this.psnavigateparams ||
      (this.psnavigateparams = this.fillChildListModel(
        this.M.getPSNavigateParams,
        S._8a,
      ) as IPSNavigateParam[])
    );
  }

  findPSNavigateParam(objKey: any): IPSNavigateParam | null {
    return this.getPSModel5(
      S._8a,
      this.getPSNavigateParams(),
      objKey,
    ) as IPSNavigateParam;
  }

  protected pssyscss: IPSSysCss;
  getPSSysCss(): IPSSysCss | null {
    return (
      this.pssyscss ||
      (this.pssyscss = this.fillObjectModel(
        S._278,
        this.M.getPSSysCss,
        S._2ac,
      ) as IPSSysCss)
    );
  }

  protected pssysimage: IPSSysImage;
  getPSSysImage(): IPSSysImage | null {
    return (
      this.pssysimage ||
      (this.pssysimage = this.fillObjectModel(
        S._27b,
        this.M.getPSSysImage,
        S._2ad,
      ) as IPSSysImage)
    );
  }

  protected pssyspfplugin: IPSSysPFPlugin;
  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    return (
      this.pssyspfplugin ||
      (this.pssyspfplugin = this.fillObjectModel(
        S._27c,
        this.M.getPSSysPFPlugin,
        S._2a7,
      ) as IPSSysPFPlugin)
    );
  }

  get titleBarCloseMode(): 0 | 1 | 2 {
    return this.M.titleBarCloseMode != null ? this.M.titleBarCloseMode : 0;
  }

  get tooltip(): string {
    return this.M.tooltip;
  }

  protected tooltippslanguageres: IPSLanguageRes;
  getTooltipPSLanguageRes(): IPSLanguageRes | null {
    return (
      this.tooltippslanguageres ||
      (this.tooltippslanguageres = this.fillObjectModel(
        S._276,
        this.M.getTooltipPSLanguageRes,
        S._2c5,
      ) as IPSLanguageRes)
    );
  }

  get disableClose(): boolean {
    return this.M.disableClose != null ? this.M.disableClose : false;
  }

  get expanded(): boolean {
    return this.M.expanded != null ? this.M.expanded : false;
  }

  get hidden(): boolean {
    return this.M.hidden != null ? this.M.hidden : false;
  }

  get hideSideBar(): boolean {
    return this.M.hideSideBar != null ? this.M.hideSideBar : false;
  }

  get openDefault(): boolean {
    return this.M.openDefault != null ? this.M.openDefault : false;
  }

  get seperator(): boolean {
    return this.M.seperator != null ? this.M.seperator : false;
  }

  get valid(): boolean {
    return this.M.valid != null ? this.M.valid : true;
  }
  get cls(): string {
    return 'PSAppMenuItemImplBase';
  }
  instanceof(cls: string): boolean {
    if (cls == S._7 || cls == S._ae || cls == S._ac || cls == S._da)
      return true;
    return super.instanceof(cls);
  }
}
